define([
    "UtilDir/util",
    "UtilDir/tool",
    "UtilDir/combotree",
    "UtilDir/org/selectOrg",
    "UtilDir/searchBlock",
    "UtilDir/loading",
    "Date", "DateCN", "css!DateCss",
    "EasyUI", "EasyUI-lang",
], function (Util, Tool, Combotree, SelectOrg, SearchBlock, Loading) {
    var getController = function () {
        return getServer() + "/pc";
    };

    // 初始化
    var init = function () {
        initSearchBlock();
        queryBtnBind();
        initcreateProvince();
        var url = window.location.href;
        var pageType = url.split("=")[url.split("=").length - 1];
        switch (pageType) {
            case 'cityHouse':
                createAuditGrid1();
                break;
            case 'cityNoHouse':
                createAuditGrid2();
                break;
            case 'countryDuli':
                createAuditGrid3();
                break;
            case 'countryJihe':
                createAuditGrid4();
                break;
            case 'countryFuzhu':
                createAuditGrid5();
                break;
            case 'countryNoHouse':
                createAuditGrid6();
                break;
            case 'bridge':
                createAuditGrid7();
                break;
            case 'water':
                createAuditGrid8();
                break;
        }
    }

    var loading = Loading({
        text : "正在质检"
    });

    var initcreateProvince = function () {
        var html = "";
        $("#citySelect").append(html);
        $("#areaSelect").append(html);
        $.ajax({
            url: getServer() + "/divisions/root/subdivisions",
            contentType: "application/json",
            type: "get",
            success: function (data) {
                //console.log(data)
                $.each(data, function (idx, item) {
                    html += "<option value='" + item.divisionName + "' exid='" + item.divisionId + "'>" + item.divisionName + "</option>";
                });
                $("#provinceSelect").append(html);
            }
        });
        $("#provinceSelect").change(function () {
            var html = '<option value="" disabled selected style="display:none;">请选择</option>';
            $("#citySelect option").remove();
            $("#citySelect").append(html);
            $("#areaSelect option").remove();
            $("#areaSelect").append(html);
            var divisionId = $(this).find("option:selected").attr("exid");
            if ($(this).val() == "北京市" || $(this).val() == "天津市" || $(this).val() == "上海市" || $(this).val() == "重庆市") {
                $("#citySelect").append("<option value='" + $(this).val() + "' exid='" + divisionId + "'>" + $(this).val() + "</option>");
                return;
            }
            $.ajax({
                url: getServer() + "/divisions/" + divisionId + "/subdivisions",
                contentType: "application/json",
                type: "get",
                success: function (data) {
                    $.each(data, function (idx, item) {
                        html += "<option value='" + item.divisionName + "' exid='" + item.divisionId + "'>" + item.divisionName + "</option>";
                    });
                    $("#citySelect").append(html);
                }
            });
        });
        $("#citySelect").change(function () {
            if ($(this).val() == "") return;
            var html = '<option value="" disabled selected style="display:none;">请选择</option>';
            $("#areaSelect option").remove();
            $("#areaSelect").append(html);
            var divisionId = $(this).find("option:selected").attr("exid");
            $.ajax({
                url: getServer() + "/divisions/" + divisionId + "/subdivisions",
                contentType: "application/json",
                type: "get",
                success: function (data) {
                    $.each(data, function (idx, item) {
                        html += "<option value='" + item.divisionName + "' exid='" + item.divisionId + "'>" + item.divisionName + "</option>";
                    });
                    $("#areaSelect").append(html);
                }
            });
        });
    }
    var initSearchBlock = function () {
        SearchBlock.init("searchBlock");
        require(["jquery", "Date", "DateCN", "css!DateCss"], function ($) {
            $("#projectCompleteDateIndex").datetimepicker({
                //设置使用语言：cn是自定义的中文版本，还可以扩展其他语言版本
                language: "cn",
                //输出格式化
                format: 'yyyy-mm-dd',
                //直接选择‘今天’
                todayBtn: true,
                //设置最精确的时间选择视图
                minView: 'month',
                //高亮当天日期
                todayHighlight: true,
                //显示“上午”“下午”
                showMeridian: true,
                //选择完毕后自动关闭
                autoclose: true
            });
            /* 删除按钮 */
            $("#complex_show0").on("click", function () {
                $('#projectCompleteDateIndex').datetimepicker('show');
            });
            /* 显示按钮 */
            $("#complex_del0").on("click", function () {
                $("#projectCompleteDateIndex").val("");
            });

            $("#complex1").datetimepicker({
                //设置使用语言：cn是自定义的中文版本，还可以扩展其他语言版本
                language: "cn",
                //输出格式化
                format: 'yyyy-mm-dd',
                //直接选择‘今天’
                todayBtn: true,
                //设置最精确的时间选择视图
                minView: 'month',
                //高亮当天日期
                todayHighlight: true,
                //显示“上午”“下午”
                showMeridian: true,
                //选择完毕后自动关闭
                autoclose: true
            });
            /* 删除按钮 */
            $("#complex_show1").on("click", function () {
                $('#complex1').datetimepicker('show');
            });
            /* 显示按钮 */
            $("#complex_del1").on("click", function () {
                $("#complex1").val("");
            });

            $("#complex2").datetimepicker({
                //设置使用语言：cn是自定义的中文版本，还可以扩展其他语言版本
                language: "cn",
                //输出格式化
                format: 'yyyy-mm-dd',
                //直接选择‘今天’
                todayBtn: true,
                //设置最精确的时间选择视图
                minView: 'month',
                //高亮当天日期
                todayHighlight: true,
                //显示“上午”“下午”
                showMeridian: true,
                //选择完毕后自动关闭
                autoclose: true
            });
            /* 删除按钮 */
            $("#complex_show2").on("click", function () {
                $('#complex2').datetimepicker('show');
            });
            /* 显示按钮 */
            $("#complex_del2").on("click", function () {
                $("#complex2").val("");
            });
        })

    };
    var queryBtnBind = function () {
        $("#complex1").change(function () {
            if ($("#complex1").val() != "" && $("#complex2").val() != "") {
                if ($("#complex1").val() > $("#complex2").val()) {
                    Util.alert("开始时间必须小于等于结束时间", function () {
                        $("#complex1").val("");
                        $("#complex2").val("");
                    });
                    return;
                }
            }
        });
        $("#complex2").change(function () {
            if ($("#complex1").val() != "" && $("#complex2").val() != "") {
                if ($("#complex1").val() > $("#complex2").val()) {
                    Util.alert("开始时间必须小于等于结束时间", function () {
                        $("#complex1").val("");
                        $("#complex2").val("");
                    });
                    return;
                }
            }
        });

        $("#btnSearch").click(function () {
            var url = window.location.href;
            var pageType = url.split("=")[url.split("=").length - 1];
            switch (pageType) {
                case 'cityHouse':
                    createAuditGrid1();
                    break;
                case 'cityNoHouse':
                    createAuditGrid2();
                    break;
                case 'countryDuli':
                    createAuditGrid3();
                    break;
                case 'countryJihe':
                    createAuditGrid4();
                    break;
                case 'countryFuzhu':
                    createAuditGrid5();
                    break;
                case 'countryNoHouse':
                    createAuditGrid6();
                    break;
                case 'bridge':
                    createAuditGrid7();
                    break;
                case 'water':
                    createAuditGrid8();
                    break;
            }
        });
        $("#btnReset").click(function () {
            $("#provinceSelect").val("");
            $("#citySelect").val("");
            $("#areaSelect").val("");
            $("#complex1").val("");
            $("#complex2").val("");
        });
    };

    var createAuditGrid1 = function () {
        $("#auditGrid").datagrid({
            url: getServer() + "/pc/yhDisaster/findData/1",
            method: "GET",
            fitColumns: true,
            autoRowHeight: false,
            columns: [
                [
                    {
                        field: 'province',
                        title: '省',sortable:true,
                        width: '12%',
                        align: 'center',
                    },
                    {
                        field: 'city',
                        title: '市',sortable:true,
                        width: '12%',
                        align: 'center',
                    },
                    {
                        field: 'area',
                        title: '区（县）',sortable:true,
                        width: '12%',
                        align: 'center',
                    },
                    {
                        field: 'yhCode',
                        title: '对象编号',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'yhFieldType',
                        title: '使用类型',
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'yhEarthIntensity',
                        title: '原结构抗震设防烈度',
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'yhNowEarthQh',
                        title: '现行抗震设防烈度',
                        width: '10%',
                        align: 'center',

                    },
                    {
                        field: 'isUpToStandard',
                        title: '抗震设防标准是否达标',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == true) {
                                return '达标';
                            }else {
                                return '未达标';
                            }
                        }
                    },
                    {
                        field: 'rvalue',
                        title: '厂址影响系数',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'vvalue',
                        title: '承灾体易损性影响系数',sortable:true,
                        width: '10%',
                        align: 'center',

                    },
                    {
                        field: 'cvalue',
                        title: '承灾体破坏后果影响系数',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'pheq',
                        title: '地震灾害隐患指数',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'isReportPg',
                        title: '是否上报pg库',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == 1) {
                                return '已上报';
                            } else {
                                return '未上报';
                            }
                        }
                    },
                    {
                        field: 'createUser',
                        title: '上传人',
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'createTime',
                        title: '上传日期',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'qualityStatus',
                        title: '质检状态',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == 0 || value == null || value == 'null') {
                                return '未质检';
                            } else if (value == 1) {
                                return '质检通过';
                            } else if (value == 2) {
                                return '质检未通过';
                            }
                        }
                    },
                    {
                        field: 'qualityComment',
                        title: '质检意见',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == 'null') {
                                return null;
                            }else{
                                return value;
                            }
                        }
                    },
                ]
            ],
            toolbar: [{
                iconCls: 'fa fa-download',
                text: "导出",
                handler: function () {
                    window.location.href = getServer() + "/pc/yhDisaster/export/1";
                }
            }, {
                iconCls: 'fa fa-share-square-o',
                text: "系统自动质检",
                handler: function () {
                    submit1();
                }
            }],
            queryParams: {
                province: $("#provinceSelect").val(),
                city: $("#citySelect").val(),
                area: $("#areaSelect").val(),
                startTime: $("#complex1").val(),
                endTime: $("#complex2").val(),
            },
            pagination: true,
            pageSize: 10
        });
    };
    // 系统自动质检
    var submit1 = function () {
        var queryVo= {
                province: $("#provinceSelect").val(),
                city: $("#citySelect").val(),
                area: $("#areaSelect").val(),
                startTime: $("#complex1").val(),
                endTime: $("#complex2").val(),
            };
        loading.show();
        $.ajax({
            url: getServer() + "/pc/yhDisaster/dataQualityCheck/1",
            contentType: "application/json",
            data: JSON.stringify(queryVo),
            type: "post",
            success: function (data) {
                loading.close();
                Util.alert(data.message)
                createAuditGrid1();
            }
        });
    };
    var createAuditGrid2 = function () {
        $("#auditGrid").datagrid({
            url: getServer() + "/pc/yhDisaster/findData/2",
            method: "GET",
            fitColumns: true,
            autoRowHeight: false,
            columns: [
                [
                    {
                        field: 'province',
                        title: '省',sortable:true,
                        width: '12%',
                        align: 'center',
                    },
                    {
                        field: 'city',
                        title: '市',sortable:true,
                        width: '12%',
                        align: 'center',
                    },
                    {
                        field: 'area',
                        title: '区（县）',sortable:true,
                        width: '12%',
                        align: 'center',
                    },
                    {
                        field: 'yhCode',
                        title: '对象编号',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'yhFieldType',
                        title: '使用类型',
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'yhEarthIntensity',
                        title: '原结构抗震设防烈度',
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'yhNowEarthQh',
                        title: '现行抗震设防烈度',
                        width: '10%',
                        align: 'center',

                    },
                    {
                        field: 'isUpToStandard',
                        title: '抗震设防标准是否达标',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == true) {
                                return '达标';
                            }else {
                                return '未达标';
                            }
                        }
                    },
                    {
                        field: 'rvalue',
                        title: '厂址影响系数',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'vvalue',
                        title: '承灾体易损性影响系数',sortable:true,
                        width: '10%',
                        align: 'center',

                    },
                    {
                        field: 'cvalue',
                        title: '承灾体破坏后果影响系数',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'pheq',
                        title: '地震灾害隐患指数',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'isReportPg',
                        title: '是否上报pg库',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == 1) {
                                return '已上报';
                            } else {
                                return '未上报';
                            }
                        }
                    },
                    {
                        field: 'createUser',
                        title: '上传人',
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'createTime',
                        title: '上传日期',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'qualityStatus',
                        title: '质检状态',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == 0 || value == null || value == 'null') {
                                return '未质检';
                            } else if (value == 1) {
                                return '质检通过';
                            } else if (value == 2) {
                                return '质检未通过';
                            }
                        }
                    },
                    {
                        field: 'qualityComment',
                        title: '质检意见',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == 'null') {
                                return null;
                            }else{
                                return value;
                            }
                        }
                    },
                ]
            ],
            toolbar: [{
                iconCls: 'fa fa-download',
                text: "导出",
                handler: function () {
                    window.location.href = getServer() + "/pc/yhDisaster/export/2";
                }
            }, {
                iconCls: 'fa fa-share-square-o',
                text: "系统自动质检",
                handler: function () {
                    submit2();
                }
            }],
            queryParams: {
                province: $("#provinceSelect").val(),
                city: $("#citySelect").val(),
                area: $("#areaSelect").val(),
                startTime: $("#complex1").val(),
                endTime: $("#complex2").val(),
            },
            pagination: true,
            pageSize: 10
        });
    };
    // 系统自动质检
    var submit2 = function () {
        var queryVo= {
                province: $("#provinceSelect").val(),
                city: $("#citySelect").val(),
                area: $("#areaSelect").val(),
                startTime: $("#complex1").val(),
                endTime: $("#complex2").val(),
            };
        loading.show();
        $.ajax({
            url: getServer() + "/pc/yhDisaster/dataQualityCheck/2",
            contentType: "application/json",
            data: JSON.stringify(queryVo),
            type: "post",
            success: function (data) {
                loading.close();
                Util.alert(data.message)
                createAuditGrid2();
            }
        });
    };
    var createAuditGrid3 = function () {
        $("#auditGrid").datagrid({
            url: getServer() + "/pc/yhDisaster/findData/3",
            method: "GET",
            fitColumns: true,
            autoRowHeight: false,
            columns: [
                [
                    {
                        field: 'province',
                        title: '省',sortable:true,
                        width: '12%',
                        align: 'center',
                    },
                    {
                        field: 'city',
                        title: '市',sortable:true,
                        width: '12%',
                        align: 'center',
                    },
                    {
                        field: 'area',
                        title: '区（县）',sortable:true,
                        width: '12%',
                        align: 'center',
                    },
                    {
                        field: 'yhCode',
                        title: '对象编号',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'yhFieldType',
                        title: '使用类型',
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'yhEarthIntensity',
                        title: '原结构抗震设防烈度',
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'yhNowEarthQh',
                        title: '现行抗震设防烈度',
                        width: '10%',
                        align: 'center',

                    },
                    {
                        field: 'isUpToStandard',
                        title: '抗震设防标准是否达标',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == true) {
                                return '达标';
                            }else {
                                return '未达标';
                            }
                        }
                    },
                    {
                        field: 'rvalue',
                        title: '厂址影响系数',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'vvalue',
                        title: '承灾体易损性影响系数',sortable:true,
                        width: '10%',
                        align: 'center',

                    },
                    {
                        field: 'cvalue',
                        title: '承灾体破坏后果影响系数',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'pheq',
                        title: '地震灾害隐患指数',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'isReportPg',
                        title: '是否上报pg库',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == 1) {
                                return '已上报';
                            } else {
                                return '未上报';
                            }
                        }
                    },
                    {
                        field: 'createUser',
                        title: '上传人',
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'createTime',
                        title: '上传日期',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'qualityStatus',
                        title: '质检状态',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == 0 || value == null || value == 'null') {
                                return '未质检';
                            } else if (value == 1) {
                                return '质检通过';
                            } else if (value == 2) {
                                return '质检未通过';
                            }
                        }
                    },
                    {
                        field: 'qualityComment',
                        title: '质检意见',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == 'null') {
                                return null;
                            }else{
                                return value;
                            }
                        }
                    },
                ]
            ],
            toolbar: [{
                iconCls: 'fa fa-download',
                text: "导出",
                handler: function () {
                    window.location.href = getServer() + "/pc/yhDisaster/export/3";
                }
            }, {
                iconCls: 'fa fa-share-square-o',
                text: "系统自动质检",
                handler: function () {
                    submit3();
                }
            }],
            queryParams: {
                province: $("#provinceSelect").val(),
                city: $("#citySelect").val(),
                area: $("#areaSelect").val(),
                startTime: $("#complex1").val(),
                endTime: $("#complex2").val(),
            },
            pagination: true,
            pageSize: 10
        });
    };
    // 系统自动质检
    var submit3 = function () {
        var queryVo= {
                province: $("#provinceSelect").val(),
                city: $("#citySelect").val(),
                area: $("#areaSelect").val(),
                startTime: $("#complex1").val(),
                endTime: $("#complex2").val(),
            };
        loading.show();
        $.ajax({
            url: getServer() + "/pc/yhDisaster/dataQualityCheck/3",
            contentType: "application/json",
            data: JSON.stringify(queryVo),
            type: "post",
            success: function (data) {
                loading.close();
                Util.alert(data.message)
                createAuditGrid3();
            }
        });
    };
    var createAuditGrid4 = function () {
        $("#auditGrid").datagrid({
            url: getServer() + "/pc/yhDisaster/findData/4",
            method: "GET",
            fitColumns: true,
            autoRowHeight: false,
            columns: [
                [
                    {
                        field: 'province',
                        title: '省',sortable:true,
                        width: '12%',
                        align: 'center',
                    },
                    {
                        field: 'city',
                        title: '市',sortable:true,
                        width: '12%',
                        align: 'center',
                    },
                    {
                        field: 'area',
                        title: '区（县）',sortable:true,
                        width: '12%',
                        align: 'center',
                    },
                    {
                        field: 'yhCode',
                        title: '对象编号',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'yhFieldType',
                        title: '使用类型',
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'yhEarthIntensity',
                        title: '原结构抗震设防烈度',
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'yhNowEarthQh',
                        title: '现行抗震设防烈度',
                        width: '10%',
                        align: 'center',

                    },
                    {
                        field: 'isUpToStandard',
                        title: '抗震设防标准是否达标',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == true) {
                                return '达标';
                            }else {
                                return '未达标';
                            }
                        }
                    },
                    {
                        field: 'rvalue',
                        title: '厂址影响系数',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'vvalue',
                        title: '承灾体易损性影响系数',sortable:true,
                        width: '10%',
                        align: 'center',

                    },
                    {
                        field: 'cvalue',
                        title: '承灾体破坏后果影响系数',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'pheq',
                        title: '地震灾害隐患指数',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'isReportPg',
                        title: '是否上报pg库',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == 1) {
                                return '已上报';
                            } else {
                                return '未上报';
                            }
                        }
                    },
                    {
                        field: 'createUser',
                        title: '上传人',
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'createTime',
                        title: '上传日期',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'qualityStatus',
                        title: '质检状态',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == 0 || value == null || value == 'null') {
                                return '未质检';
                            } else if (value == 1) {
                                return '质检通过';
                            } else if (value == 2) {
                                return '质检未通过';
                            }
                        }
                    },
                    {
                        field: 'qualityComment',
                        title: '质检意见',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == 'null') {
                                return null;
                            }else{
                                return value;
                            }
                        }
                    },
                ]
            ],
            toolbar: [{
                iconCls: 'fa fa-download',
                text: "导出",
                handler: function () {
                    window.location.href = getServer() + "/pc/yhDisaster/export/4";
                }
            }, {
                iconCls: 'fa fa-share-square-o',
                text: "系统自动质检",
                handler: function () {
                    submit4();
                }
            }],
            queryParams: {
                province: $("#provinceSelect").val(),
                city: $("#citySelect").val(),
                area: $("#areaSelect").val(),
                startTime: $("#complex1").val(),
                endTime: $("#complex2").val(),
            },
            pagination: true,
            pageSize: 10
        });
    };
    // 系统自动质检
    var submit4 = function () {
        var queryVo= {
                province: $("#provinceSelect").val(),
                city: $("#citySelect").val(),
                area: $("#areaSelect").val(),
                startTime: $("#complex1").val(),
                endTime: $("#complex2").val(),
            };
        loading.show();
        $.ajax({
            url: getServer() + "/pc/yhDisaster/dataQualityCheck/4",
            contentType: "application/json",
            data: JSON.stringify(queryVo),
            type: "post",
            success: function (data) {
                loading.close();
                Util.alert(data.message)
                createAuditGrid4();
            }
        });
    };
    var createAuditGrid5 = function () {
        $("#auditGrid").datagrid({
            url: getServer() + "/pc/yhDisaster/findData/5",
            method: "GET",
            fitColumns: true,
            autoRowHeight: false,
            columns: [
                [
                    {
                        field: 'province',
                        title: '省',sortable:true,
                        width: '12%',
                        align: 'center',
                    },
                    {
                        field: 'city',
                        title: '市',sortable:true,
                        width: '12%',
                        align: 'center',
                    },
                    {
                        field: 'area',
                        title: '区（县）',sortable:true,
                        width: '12%',
                        align: 'center',
                    },
                    {
                        field: 'yhCode',
                        title: '对象编号',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'yhFieldType',
                        title: '使用类型',
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'yhEarthIntensity',
                        title: '原结构抗震设防烈度',
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'yhNowEarthQh',
                        title: '现行抗震设防烈度',
                        width: '10%',
                        align: 'center',

                    },
                    {
                        field: 'isUpToStandard',
                        title: '抗震设防标准是否达标',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == true) {
                                return '达标';
                            }else {
                                return '未达标';
                            }
                        }
                    },
                    {
                        field: 'rvalue',
                        title: '厂址影响系数',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'vvalue',
                        title: '承灾体易损性影响系数',sortable:true,
                        width: '10%',
                        align: 'center',

                    },
                    {
                        field: 'cvalue',
                        title: '承灾体破坏后果影响系数',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'pheq',
                        title: '地震灾害隐患指数',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'isReportPg',
                        title: '是否上报pg库',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == 1) {
                                return '已上报';
                            } else {
                                return '未上报';
                            }
                        }
                    },
                    {
                        field: 'createUser',
                        title: '上传人',
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'createTime',
                        title: '上传日期',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'qualityStatus',
                        title: '质检状态',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == 0 || value == null || value == 'null') {
                                return '未质检';
                            } else if (value == 1) {
                                return '质检通过';
                            } else if (value == 2) {
                                return '质检未通过';
                            }
                        }
                    },
                    {
                        field: 'qualityComment',
                        title: '质检意见',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == 'null') {
                                return null;
                            }else{
                                return value;
                            }
                        }
                    },
                ]
            ],
            toolbar: [{
                iconCls: 'fa fa-download',
                text: "导出",
                handler: function () {
                    window.location.href = getServer() + "/pc/yhDisaster/export/5";
                }
            }, {
                iconCls: 'fa fa-share-square-o',
                text: "系统自动质检",
                handler: function () {
                    submit5();
                }
            }],
            queryParams: {
                province: $("#provinceSelect").val(),
                city: $("#citySelect").val(),
                area: $("#areaSelect").val(),
                startTime: $("#complex1").val(),
                endTime: $("#complex2").val(),
            },
            pagination: true,
            pageSize: 10
        });
    };
    // 系统自动质检
    var submit5 = function () {
        var queryVo= {
                province: $("#provinceSelect").val(),
                city: $("#citySelect").val(),
                area: $("#areaSelect").val(),
                startTime: $("#complex1").val(),
                endTime: $("#complex2").val(),
            };
        loading.show();
        $.ajax({
            url: getServer() + "/pc/yhDisaster/dataQualityCheck/5",
            contentType: "application/json",
            data: JSON.stringify(queryVo),
            type: "post",
            success: function (data) {
                loading.close();
                Util.alert(data.message)
                createAuditGrid5();
            }
        });
    };
    var createAuditGrid6 = function () {
        $("#auditGrid").datagrid({
            url: getServer() + "/pc/yhDisaster/findData/6",
            method: "GET",
            fitColumns: true,
            autoRowHeight: false,
            columns: [
                [
                    {
                        field: 'province',
                        title: '省',sortable:true,
                        width: '12%',
                        align: 'center',
                    },
                    {
                        field: 'city',
                        title: '市',sortable:true,
                        width: '12%',
                        align: 'center',
                    },
                    {
                        field: 'area',
                        title: '区（县）',sortable:true,
                        width: '12%',
                        align: 'center',
                    },
                    {
                        field: 'yhCode',
                        title: '对象编号',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'yhFieldType',
                        title: '使用类型',
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'yhEarthIntensity',
                        title: '原结构抗震设防烈度',
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'yhNowEarthQh',
                        title: '现行抗震设防烈度',
                        width: '10%',
                        align: 'center',

                    },
                    {
                        field: 'isUpToStandard',
                        title: '抗震设防标准是否达标',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == true) {
                                return '达标';
                            }else {
                                return '未达标';
                            }
                        }
                    },
                    {
                        field: 'rvalue',
                        title: '厂址影响系数',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'vvalue',
                        title: '承灾体易损性影响系数',sortable:true,
                        width: '10%',
                        align: 'center',

                    },
                    {
                        field: 'cvalue',
                        title: '承灾体破坏后果影响系数',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'pheq',
                        title: '地震灾害隐患指数',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'isReportPg',
                        title: '是否上报pg库',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == 1) {
                                return '已上报';
                            } else {
                                return '未上报';
                            }
                        }
                    },
                    {
                        field: 'createUser',
                        title: '上传人',
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'createTime',
                        title: '上传日期',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'qualityStatus',
                        title: '质检状态',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == 0 || value == null || value == 'null') {
                                return '未质检';
                            } else if (value == 1) {
                                return '质检通过';
                            } else if (value == 2) {
                                return '质检未通过';
                            }
                        }
                    },
                    {
                        field: 'qualityComment',
                        title: '质检意见',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == 'null') {
                                return null;
                            }else{
                                return value;
                            }
                        }
                    },
                ]
            ],
            toolbar: [{
                iconCls: 'fa fa-download',
                text: "导出",
                handler: function () {
                    window.location.href = getServer() + "/pc/yhDisaster/export/6";
                }
            }, {
                iconCls: 'fa fa-share-square-o',
                text: "系统自动质检",
                handler: function () {
                    submit6();
                }
            }],
            queryParams: {
                province: $("#provinceSelect").val(),
                city: $("#citySelect").val(),
                area: $("#areaSelect").val(),
                startTime: $("#complex1").val(),
                endTime: $("#complex2").val(),
            },
            pagination: true,
            pageSize: 10
        });
    };
    // 系统自动质检
    var submit6 = function () {
        var queryVo= {
                province: $("#provinceSelect").val(),
                city: $("#citySelect").val(),
                area: $("#areaSelect").val(),
                startTime: $("#complex1").val(),
                endTime: $("#complex2").val(),
            };
        loading.show();
        $.ajax({
            url: getServer() + "/pc/yhDisaster/dataQualityCheck/6",
            contentType: "application/json",
            data: JSON.stringify(queryVo),
            type: "post",
            success: function (data) {
                loading.close();
                Util.alert(data.message)
                createAuditGrid6();
            }
        });
    };
    var createAuditGrid7 = function () {
        $("#auditGrid").datagrid({
            url: getServer() + "/pc/yhDisaster/findData/7",
            method: "GET",
            fitColumns: true,
            autoRowHeight: false,
            columns: [
                [
                    {
                        field: 'province',
                        title: '省',sortable:true,
                        width: '12%',
                        align: 'center',
                    },
                    {
                        field: 'city',
                        title: '市',sortable:true,
                        width: '12%',
                        align: 'center',
                    },
                    {
                        field: 'area',
                        title: '区（县）',sortable:true,
                        width: '12%',
                        align: 'center',
                    },
                    {
                        field: 'yhCode',
                        title: '对象编号',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'yhEarthIntensity',
                        title: '原结构抗震设防烈度',
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'yhNowEarthQh',
                        title: '现行抗震设防烈度',
                        width: '10%',
                        align: 'center',

                    },
                    {
                        field: 'isUpToStandard',
                        title: '抗震设防标准是否达标',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == true) {
                                return '达标';
                            }else {
                                return '未达标';
                            }
                        }
                    },
                    {
                        field: 'rvalue',
                        title: '厂址影响系数',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'vvalue',
                        title: '承灾体易损性影响系数',sortable:true,
                        width: '10%',
                        align: 'center',

                    },
                    {
                        field: 'cvalue',
                        title: '承灾体破坏后果影响系数',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'pheq',
                        title: '地震灾害隐患指数',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'isReportPg',
                        title: '是否上报pg库',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == 1) {
                                return '已上报';
                            } else {
                                return '未上报';
                            }
                        }
                    },
                    {
                        field: 'createUser',
                        title: '上传人',
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'createTime',
                        title: '上传日期',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'qualityStatus',
                        title: '质检状态',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == 0 || value == null || value == 'null') {
                                return '未质检';
                            } else if (value == 1) {
                                return '质检通过';
                            } else if (value == 2) {
                                return '质检未通过';
                            }
                        }
                    },
                    {
                        field: 'qualityComment',
                        title: '质检意见',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == 'null') {
                                return null;
                            }else{
                                return value;
                            }
                        }
                    },
                ]
            ],
            toolbar: [{
                iconCls: 'fa fa-download',
                text: "导出",
                handler: function () {
                    window.location.href = getServer() + "/pc/yhDisaster/export/7";
                }
            }, {
                iconCls: 'fa fa-share-square-o',
                text: "系统自动质检",
                handler: function () {
                    submit7();
                }
            }],
            queryParams: {
                province: $("#provinceSelect").val(),
                city: $("#citySelect").val(),
                area: $("#areaSelect").val(),
                startTime: $("#complex1").val(),
                endTime: $("#complex2").val(),
            },
            pagination: true,
            pageSize: 10
        });
    };
    // 系统自动质检
    var submit7 = function () {
        var queryVo= {
                province: $("#provinceSelect").val(),
                city: $("#citySelect").val(),
                area: $("#areaSelect").val(),
                startTime: $("#complex1").val(),
                endTime: $("#complex2").val(),
            };
        loading.show();
        $.ajax({
            url: getServer() + "/pc/yhDisaster/dataQualityCheck/7",
            contentType: "application/json",
            data: JSON.stringify(queryVo),
            type: "post",
            success: function (data) {
                loading.close();
                Util.alert(data.message)
                createAuditGrid7();
            }
        });
    };
    var createAuditGrid8 = function () {
        $("#auditGrid").datagrid({
            url: getServer() + "/pc/yhDisaster/findData/8",
            method: "GET",
            fitColumns: true,
            autoRowHeight: false,
            columns: [
                [
                    {
                        field: 'province',
                        title: '省',sortable:true,
                        width: '12%',
                        align: 'center',
                    },
                    {
                        field: 'city',
                        title: '市',sortable:true,
                        width: '12%',
                        align: 'center',
                    },
                    {
                        field: 'area',
                        title: '区（县）',sortable:true,
                        width: '12%',
                        align: 'center',
                    },
                    {
                        field: 'yhCode',
                        title: '对象编号',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'yhEarthIntensity',
                        title: '原结构抗震设防烈度',
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'yhNowEarthQh',
                        title: '现行抗震设防烈度',
                        width: '10%',
                        align: 'center',

                    },
                    {
                        field: 'isUpToStandard',
                        title: '抗震设防标准是否达标',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == true) {
                                return '达标';
                            }else {
                                return '未达标';
                            }
                        }
                    },
                    {
                        field: 'rvalue',
                        title: '厂址影响系数',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'vvalue',
                        title: '承灾体易损性影响系数',sortable:true,
                        width: '10%',
                        align: 'center',

                    },
                    {
                        field: 'cvalue',
                        title: '承灾体破坏后果影响系数',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'pheq',
                        title: '地震灾害隐患指数',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'isReportPg',
                        title: '是否上报pg库',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == 1) {
                                return '已上报';
                            } else {
                                return '未上报';
                            }
                        }
                    },
                    {
                        field: 'createUser',
                        title: '上传人',
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'createTime',
                        title: '上传日期',sortable:true,
                        width: '10%',
                        align: 'center',
                    },
                    {
                        field: 'qualityStatus',
                        title: '质检状态',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == 0 || value == null || value == 'null') {
                                return '未质检';
                            } else if (value == 1) {
                                return '质检通过';
                            } else if (value == 2) {
                                return '质检未通过';
                            }
                        }
                    },
                    {
                        field: 'qualityComment',
                        title: '质检意见',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == 'null') {
                                return null;
                            }else{
                                return value;
                            }
                        }
                    },
                ]
            ],
            toolbar: [{
                iconCls: 'fa fa-download',
                text: "导出",
                handler: function () {
                    window.location.href = getServer() + "/pc/yhDisaster/export/8";
                }
            }, {
                iconCls: 'fa fa-share-square-o',
                text: "系统自动质检",
                handler: function () {
                    submit8();
                }
            }],
            queryParams: {
                province: $("#provinceSelect").val(),
                city: $("#citySelect").val(),
                area: $("#areaSelect").val(),
                startTime: $("#complex1").val(),
                endTime: $("#complex2").val(),
            },
            pagination: true,
            pageSize: 10
        });

    };
    // 系统自动质检
    var submit8 = function () {
        var queryVo= {
                province: $("#provinceSelect").val(),
                city: $("#citySelect").val(),
                area: $("#areaSelect").val(),
                startTime: $("#complex1").val(),
                endTime: $("#complex2").val(),
            };
        loading.show();
        $.ajax({
            url: getServer() + "/pc/yhDisaster/dataQualityCheck/8",
            contentType: "application/json",
            data: JSON.stringify(queryVo),
            type: "post",
            success: function (data) {
                loading.close();
                Util.alert(data.message)
                createAuditGrid8();
            }
        });
    };
    return {
        init: init
    }
})